<?php
namespace app\admin\controller;
use app\admin\model\Login;
use think\Controller;
use think\Session;
class Logins{
    public function index(){
        $Login = new Login();
        try{
            $user = $Login->login();
            $menuData = $Login->getMenuData($user['role_id']);
            $accessUrls = $Login->getAccessUrls($user['role_id']);
            Session::set('user',$user);
            Session::set('accessUrls',$accessUrls);
            return['status'=>true,'menuData'=>$menuData,'user'=>$user];
        }catch (\Exception $e){
            return['status'=>false,'error'=>$e->getMessage()];
        }
    }
}
